<template>
  <div class="components-container">
    <div class="header-form">
      <div class="layui-inline" v-if="isShowBuessnum? true : !this.IsSendJoint">
        <label class="layui-form-label">业务编号</label>
        <div class="layui-inline">
          <el-input v-model="selectData.RegbussnumLike" placeholder="请输入业务编号" @keydown.enter.native="btnSearch"></el-input>
        </div>
      </div>
      <div class="layui-inline" v-if="isShowOldDate? false : this.IsSendJoint">
        <label class="layui-form-label" style="width:85px;">老数据标识</label>
        <div class="layui-inline">
          <el-input v-model="selectData.RegbarnoEquals" placeholder="请输入老数据标识" @keydown.enter.native="btnSearch"></el-input>
        </div>
      </div>
      <div class="layui-inline" v-if="this.IsSendJoint">
        <label class="layui-form-label">证件号码</label>
        <div class="layui-inline">
          <el-input v-model="selectData.RegCardnoEquals" placeholder="请输入证件号码" @keydown.enter.native="btnSearch"></el-input>
        </div>
      </div>
      <div class="layui-inline">
        <label class="layui-form-label">逝者姓名</label>
        <div class="layui-inline">
          <el-input v-model="selectData.RegnameLike" placeholder="请输入逝者姓名" @keydown.enter.native="btnSearch"></el-input>
        </div>
      </div>
      <div class="layui-inline">
        <label class="layui-form-label">客户姓名</label>
        <div class="layui-inline">
          <el-input v-model="selectData.ReghandlernameLike" placeholder="请输入客户姓名" @keydown.enter.native="btnSearch"></el-input>
        </div>
      </div>
      <el-button type="primary" @click="btnSearch" :loading="this.$store.state.isloading">搜索</el-button>
      <el-button type="warning" @click="btnRepeat">重置</el-button>
    </div>
    <!-- 加tab -->
     <el-tabs v-model="activeName" type="card" style="margin-top:10px;">
       <el-tab-pane label="查询条件" name="search">
            <div :style="{maxHeight:maxHeight+'px'}" style="overflow:auto;">
                    <div class="layui-form-item">
                        <div class="layui-inline">
                          <label class="layui-form-label">冰柜号</label>
                          <div class="layui-input-inline">
                            <el-select v-model="selectData.ICENOEquals" filterable>
                              <el-option v-for="item in icenum" :key="item.ICENAME" :label="item.ICENAME" :value="item.ICENAME">
                              </el-option>
                            </el-select>
                          </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label" >火化日期</label>
                            <el-date-picker v-date v-model="selectData.RegAppointDateGreaterAndEquals" type="date" placeholder="选择日期范围" >
                            </el-date-picker>
                            <el-date-picker v-date v-model="selectData.RegAppointDateLessAndEquals" type="date" placeholder="选择日期范围">
                            </el-date-picker>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label" >接尸日期</label>
                            <el-date-picker v-date v-model="selectData.CdhactualdateGreaterAndEquals" type="date" placeholder="选择日期范围" >
                            </el-date-picker>
                            <el-date-picker v-date v-model="selectData.CdhactualdateLessAndEquals" type="date" placeholder="选择日期范围">
                            </el-date-picker>
                        </div>
                    </div>

                   
              <div class="layui-form-item btnCenter">
               <el-button type="primary" @click="btnSearch" :loading="this.$store.state.isloading">搜索</el-button>
               <el-button type="warning" @click="btnRepeat">重置</el-button>
            </div>
            </div>
            </el-tab-pane>
            <el-tab-pane label="查询结果" name="results">
                <div style="margin-top:10px;">
                <ul class="toolList">
                    <li>
                    <el-button type="primary" @click="btnSearch" :loading="this.$store.state.isloading">刷新</el-button>
                    </li>
                    <li>
                    <el-button type="primary" :disabled="this.$store.state.isloading" @click="exportExcel" style="margin-left:20px;">导出Excel</el-button>
                    </li>
                    <li v-if="btnShow(item.BTNVALUE)" v-for="(item, index) in $store.state.btnListCommon" @click="operate(item.BTNVALUE)" :key=index>
                    <el-button type="primary" :value="item.BTNSHOWNAME" v-text="item.BTNSHOWNAME"></el-button>
                    </li>
                </ul>
                </div>
    <dataTable :headList="headList" :dataList="dataList" :hiddenWarn="hiddenWarn" :clounmnames="clounmnames" :pageOrder="pageOrder" @pageChange="pageChange" @selectRow="selectRow"></dataTable>

    <cresimplereg ref="simpleReg" @searchMatchData="searchMatchData" :orderType="order" @refreshData="btnsearch"></cresimplereg>
    <printmodal ref="printPdf"></printmodal>
    <Appendixlists ref="dialog"></Appendixlists>
    <Appendixlisttwo ref="dialogs"></Appendixlisttwo>
    <carSendNewMain ref="carSendNewMain"></carSendNewMain>
    <!-- 宁波调整收费项目 -->
    <checkout-add ref="checkoutAdd" @refreshData="getData"></checkout-add>  
    <!-- 操作历史 -->
    <OperationHistory ref="OperationHistory"></OperationHistory>
    <!-- 生成联办单 -->
    <seecSingle ref="seecSingle"></seecSingle>
    </el-tab-pane>
    </el-tabs>
  </div>
</template>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/common.scss";
.el-button + .el-button {
    margin-left: 0;
}
.longtext {
    width: 480px;
}
.longertext {
    width: 770px;
}
.sweet-btn {
    margin-top: 20px;
}
.radio {
    margin-top: 9px;
}
.el-table .warning-row {
    background: oldlace;
}

.el-table .success-row {
    background: #f0f9eb;
}
</style>
<script>
import dataTable from "@/components/Table/DataTable";
import apiBase from "@/api/apiBase.js";
import { ORDER } from "@/const/orderConst.js";
import { DATESELECTMODE } from "@/const/const.js";
import { formatDate, timeStringToDate } from "@/utils/date.js";
import { manage } from "@/mixins/managePage.js";
import { PRINT } from "@/components/Pdf/PDF.js";
import printmodal from "@/components/Pdf/Print";
import cresimplereg from "@/views/businessHall/cresimplereg";
import Appendixlists from "@/views/jointPlatform/Appendixlists";
import Appendixlisttwo from "@/views/jointPlatform/Appendixlisttwo";
import OperationHistory from "@/views/jointPlatform/OperationHistory";//操作历史
import carSendNewMain from "@/views/server/carSendNewMain";
import seecSingle from "@/views/businessHall/seecSingle";
import checkoutAdd from "@/views/businessHall/checkoutAdd"; //调整收费项目
const MODIFYCHARGE = "调整收费项";  //宁波需求 
const IchValue = "1";
const UnIchValue = "2";
const alls = "3";
const ptts = "A";
const xtsc = "B";
const ptfg = "C";
export default {
    name: "cremationReg",
    mixins: [manage],
    data() {
        return {
            maxHeight: 500,
            pageWidth: 1200,
            printUrl: null,
            printTitle: null,
            SELFREGISTER: ORDER.SELFREGISTER,
            IsSendJoint: null,
            //户籍所在地
            ctyLists: [],
            Busstype: [],
            ctyInfo: null,
            DateSelectMode: DATESELECTMODE,
            IchValue: IchValue,
            UnIchValue: UnIchValue,
            alls: alls,
            ptts: ptts,
            xtsc: xtsc,
            ptfg: ptfg,
            all: null,
            isall: null,
            //查询条件
            selectData: {
                RegbonetypeEquals: null,
                RegnameLike: null,
                ReghandlernameLike: null,
                ReghandlernameLike: null,
                RegyitiqxEquals: null,
                RegdateOrRegCremationdate: null,
                RegdateGreater: null,
                RegdeathdateEquals: null,
                RegcremationdateEqual: null,
                RegbussnumLike: null,
                RegbarnoEquals: null,
                RegCardnoEquals: null,
                RegformidEquals: null,
                ICENOEquals:null,  //冰柜号
                CdhactualdateGreaterAndEquals:null,    //接尸日期开始
                CdhactualdateLessAndEquals:null,    //接尸日期结束
                RegAppointDateGreaterAndEquals:null,    //火化日期开始
                RegAppointDateLessAndEquals:null,    //火化日期结束
            },
            selectDataEixend: {
                regDateValue: null,
                regIchValue: null,
                reglyvalue: null
            },
            //编码类型
            household: [],
            causList: [],
            codeList: [],
            cause: [],
            cauinfo: [],
            szlx: [],
            ytqx: [],
            ghqx: [],
            xblx: [],
            sfzjlx: [],
            gjlb: [],
            mz: [],
            whcdlx: [],
            hyzklx: [],
            zylx: [],
            zzmmlx: [],
            hjlblx: [],
            hjszdlx: [],
            jmlx: [],
            dataalllist: [],
            icenum: [],
            activeName: "results",
            regData: {
                REGID: null,
                REGPRPID: null,
                REGDATE: null,
                REGTIME: null,
                REGBONETYPE: null,
                REGCAUSA: null,
                REGCAUSASON: null,
                REGDEATHID: null,
                REGREGPROVEUNIT: null,
                REGDEATHADDRESS: null,
                REGYITIQX: null,
                REGGHQX: null,
                REGNAME: null,
                REGSEX: null,
                REGCARDTYPE: null,
                REGCARDNO: null,
                REGBIRTHDATE: null,
                REGNATIONALITYTYPE: null,
                REGNATION: null,
                REGCULTURALDEGREE: null,
                REGMARRIAGE: null,
                REGJOB: null,
                REGPOLITICAL: null,
                REGHOUSEHOLDTYPE: null,
                REGHOUSETYPE: null,
                REGHOUSEHOLD: null,
                REGDETAILADDRESS: null,
                REGDEATHDATE: null,
                REGISKEYPOINT: null,
                REGHANDLERNAME: null,
                REGHANDSEX: null,
                REGHANDLERCARDTYPE: null,
                REGHANDLERCARDNO: null,
                REGHANDLERHOUSEHOLD: null,
                REGHANDLERLINK: null,
                REGRELATION: null,
                REGREMARK: null
            },
            regDataTime: null,
            regTime: null,
            //火化日期
            regCremationDate: null,
            //是否显示搜索中的来源
            hiddenWarn: true, //决定是否添加冻结这一列
            clounmnames: '冻结状态',//决定冻结这一列的表头名字
            ischangered: null,
            ischangnb: null,
            isFontColor: null,
            isShowBuessnum: null,
            isShowOldDate: null,
            isFirst:true
        };
    },
    methods: {
        btnsearch() {
            this.getData();
            this.getAllData();
        },
        //获取未使用冰柜信息
        getnoIce() {
            let data = {
                ICEID: ORDER.ICEID
            };
            apiBase.DoService(
                data,
                apiBase.getApiAdress().IceUse.QueryIce,
                res => {
                    this.icenum = res.data.content;
                }
            );
        },
        //导出excel
        exportExcel() {
            var header = "火化登记数据";
            if (this.dataList.length === 0) {
                this.$message.error("无导出数据！");
                return;
            }
            this.downloadLoading = true;
            require.ensure([], () => {
                const {
                    export_json_to_excel
                } = require("@/vendor/Export2Excel");
                export_json_to_excel(this.headList, this.dataalllist, header);
                this.downloadLoading = false;
            });
        },
        //获取火化登记数据
        getData() {
            let selectData = JSON.parse(JSON.stringify(this.selectData));
            if (!this.selectData.RegbussnumLike) {
                selectData.RegbussnumLike = null;
            }
            if (!this.selectData.RegCardnoEquals) {
                selectData.RegCardnoEquals = null;
            }
            if (!this.selectData.RegbarnoEquals) {
                selectData.RegbarnoEquals = null;
            }
            if (!this.selectData.RegnameLike) {
                selectData.RegnameLike = null;
            }
            if (!this.selectData.ReghandlernameLike) {
                selectData.ReghandlernameLike = null;
            }
            if(selectData.CdhactualdateGreaterAndEquals) {selectData.CdhactualdateGreaterAndEquals = formatDate(selectData.CdhactualdateGreaterAndEquals, "yyyyMMdd" );} 
            if(selectData.CdhactualdateLessAndEquals) {selectData.CdhactualdateLessAndEquals = formatDate(selectData.CdhactualdateLessAndEquals, "yyyyMMdd" );} 
            if(selectData.RegAppointDateGreaterAndEquals) {selectData.RegAppointDateGreaterAndEquals = formatDate(selectData.RegAppointDateGreaterAndEquals, "yyyyMMdd" );} 
            if(selectData.RegAppointDateLessAndEquals) {selectData.RegAppointDateLessAndEquals = formatDate(selectData.RegAppointDateLessAndEquals, "yyyyMMdd" );} 
            let data = {
                PageIndex: this.pageOrder.currentPage,
                PageSize: this.pageOrder.pageSize,
                OrderBy: this.pageOrder.orderType,
                OrderByType: this.pageOrder.orderSort,
                Data: selectData
            };

            apiBase.DoService(
                data,
                apiBase.getApiAdress().Registration.CremationRegistrationQuery,
                res => {
                    this.dataList = res.data.content.OutData;
                    this.pageOrder.totalNum = res.data.content.RecordCount;
                    this.activeName = "results";
                    this.dataList.forEach(data => {
                        data.REGDATE = data.REGDATE.substring(0, 16);
                        data.PRPCREMATIONDATEDESC = data.PRPCREMATIONDATEDESC.substring(0, 16);
                    });
                    this.$nextTick(function() {
                        let rows = document.getElementsByClassName("el-table__row");
                        if(this.ischangered){
                            this.dataList.forEach((item,index) => {
                                rows[index].style.color = '#606266';
                                if(item.REGCRETYPE === 'A'){
                                    rows[index].style.color = 'red';
                                }
                            });
                        };
                        if(this.ischangnb){
                            this.dataList.forEach((item,index) => {
                                rows[index].style.color = '#606266';
                                if(item.REGCRETYPE === 'A'||item.REGCRETYPE === 'C'){
                                    rows[index].style.color = '#007eff';
                                }
                                if(item.REGCRETYPE === 'D'){
                                    rows[index].style.color = 'red';
                                }
                            });
                        };
                        if(this.isFontColor){
                            this.dataList.forEach((item,index) => {
                                rows[index].style.color = 'black';
                                if(item.REGCURSTATUS === 'D'||item.REGISCHECK === 'B'){
                                    rows[index].style.color = '#007eff';
                                }
                                if(item.REGCURSTATUS === 'B'&& item.REGISCHECK === 'A'){
                                    rows[index].style.color = 'red';
                                }
                            });
                        };
                        
                    });
                }
            );
        },
        //获取火化登记数据
        getAllData() {
            let selectData = JSON.parse(JSON.stringify(this.selectData));
            if (!this.selectData.RegbussnumLike) {
                selectData.RegbussnumLike = null;
            }
            if (!this.selectData.RegCardnoEquals) {
                selectData.RegCardnoEquals = null;
            }
            if (!this.selectData.RegbarnoEquals) {
                selectData.RegbarnoEquals = null;
            }
            if (!this.selectData.RegnameLike) {
                selectData.RegnameLike = null;
            }
            if (!this.selectData.ReghandlernameLike) {
                selectData.ReghandlernameLike = null;
            }
            let data = {
                PageIndex: -1,
                PageSize: 1000,
                OrderBy: this.pageOrder.orderType,
                OrderByType: this.pageOrder.orderSort,
                Data: selectData
            };

            apiBase.DoService(
                data,
                apiBase.getApiAdress().Registration.CremationRegistrationQuery,
                res => {
                    this.dataalllist = res.data.content.OutData;
                    // this.pageOrder.totalNum = res.data.content.RecordCount;
                    this.dataalllist.forEach(data => {
                        data.REGDATE = data.REGDATE.substring(0, 16);
                    });
                }
            );
        },
        //获取表头
        getColumns() {
            let data = {};
            apiBase.DoService(
                data,
                apiBase.getApiAdress().Column.GetCremationRegistrationColumns,
                res => {
                    this.headList = res.data.content;
                }
            );
        },
        //获取业务状态
        getBussType() {
            let data = {};
            apiBase.DoService(
                data,
                apiBase.getApiAdress().Registration.GetBusstype,
                res => {
                    this.Busstype = res.data.content;
                }
            );
        },
        //获取编码
        getCode() {
            let data = {};
            apiBase.DoService(
                data,
                apiBase.getApiAdress().Registration.QueryAllCode,
                res => {
                    this.codeList = res.data.content;
                    for (var i in this.codeList) {
                        switch (this.codeList[i].CTPID) {
                            case "逝者类型":
                                this.szlx = this.codeList[i].Cods;
                                break;
                            case "遗体去向":
                                this.ytqx = this.codeList[i].Cods;
                                break;
                            case "骨灰去向":
                                this.ghqx = this.codeList[i].Cods;
                                break;
                            case "性别类型":
                                this.xblx = this.codeList[i].Cods;
                                break;
                            case "身份证件类型":
                                this.sfzjlx = this.codeList[i].Cods;
                                break;
                            case "国籍类别":
                                this.gjlb = this.codeList[i].Cods;

                                break;
                            case "民族":
                                this.mz = this.codeList[i].Cods;
                                break;
                            case "文化程度类型":
                                this.whcdlx = this.codeList[i].Cods;
                                break;
                            case "婚姻状况类型":
                                this.hyzklx = this.codeList[i].Cods;
                                break;
                            case "职业类型":
                                this.zylx = this.codeList[i].Cods;
                                break;
                            case "政治面貌类型":
                                this.zzmmlx = this.codeList[i].Cods;
                                break;
                            case "户籍类别类型":
                                this.hjlblx = this.codeList[i].Cods;
                                break;
                            case "户籍所在地类型":
                                this.hjszdlx = this.codeList[i].Cods;
                                break;
                            case "减免类型":
                                this.jmlx = this.codeList[i].Cods;
                                break;
                            case "员工类型":
                                this.yglx = this.codeList[i].Cods;
                                break;
                            default:
                        }
                    }
                }
            );
        },
        //获取死亡原因
        getCausa() {
            let data = {};
            apiBase.DoService(
                data,
                apiBase.getApiAdress().Code.GetCausa,
                res => {
                    let caudata = res.data.content;
                    this.cause = caudata.map(item => ({
                        label: item.CAENAME,
                        value: item.CAEID,
                        children: item.Caus.map(itemCau => ({
                            label: itemCau.CAUNAME,
                            value: itemCau.CAUID
                        }))
                    }));
                }
            );
        },
        //获取户籍所在地
        getHousehold() {
            let data = {};
            apiBase.DoService(
                data,
                apiBase.getApiAdress().Code.GetHousehold,
                res => {
                    let cardata = res.data.content;
                    this.household = cardata.map(item => ({
                        label: item.StaName,
                        value: item.StaCode,
                        children: item.List_Cty.map(itemCty => ({
                            label: itemCty.CtyName,
                            value: itemCty.CtyCode,
                            children: itemCty.List_Cnt.map(itemCnt => ({
                                label: itemCnt.CntName,
                                value: itemCnt.CntCode
                            }))
                        }))
                    }));
                }
            );
        },
        //个性话参数，是否发送身份证号码到后台
        IsSendJointByFinal() {
            let data = {};
            apiBase.DoService(
                data,
                apiBase.getApiAdress().Param.GetIsSendJointByFinal,
                res => {
                    this.IsSendJoint = res.data.content;
                }
            );
        },
        //根据编码获取所在地
        getHouseholdInfo(code) {
            let data = {
                CODE: code
            };
            apiBase.DoService(
                data,
                apiBase.getApiAdress().Registration.GetHousehold,
                res => {
                    let ctydata = res.data.content;
                    this.ctyLists = [
                        ctydata.StaCode,
                        ctydata.CtyCode,
                        ctydata.CntCode
                    ];
                    this.ctyInfo =
                        ctydata.StaName + ctydata.CtyName + ctydata.CntName;
                }
            );
        },

        btnShow(btn) { 
            // 获取联办数据
            if(btn === "获取联办数据"){
                return true
            }
            // REGISTER: '火化登记',  SELFREGISTER: '自送登记',  ONEKEYDELETE: '一键删除',
            // MODIFY: '修改',
            if (
                btn === ORDER.SELFREGISTER ||   //自送登记
                btn === "回传附件详情"||
                btn === "异地火化"   //上虞
            )
                return true; //自送等级
            if(btn === "数据匹配") return true;
            if(btn === "联办数据匹配") return true;
            if (!this.currentRow) return false;
            if(btn === "备注修改") return true;
            if(btn === "操作历史") return true;
            if(btn === "派车登记") return true;
            if (this.currentRow.REGISCHECK === "B") {
              if(btn === "打印减免清单"){
                return true
              }
              if(btn === "到馆扫描"){
                return false
              }
            }
            if (this.currentRow.REGCURSTATUS === "A") {   
                if (
                    btn === ORDER.REGISTER ||    //火化登记
                    btn === ORDER.BODYOUTAGE ||    //未到馆  遗体外运按钮不显示
                    btn === ORDER.ONEKEYDELETE ||   //一键删除
                    btn === '义乌火化登记' ||
                    btn === "到馆扫描"
                ){
                    return true;
                }else{
                    return false;
                }
            } else if (btn === ORDER.REGISTER || btn === '义乌火化登记'){
                return false;
            }


            if (this.currentRow.REGCURSTATUS != "E") {
                if (btn === ORDER.ESCBODYOUTAGE) return false;   //取消遗体外运
            }
            if (this.currentRow.REGCURSTATUS === "E") {
                if (btn === ORDER.ESCBODYOUTAGE) {     //取消遗体外运
                    return true;
                } else if (btn === ORDER.BODYOUTAGE) {  //遗体外运
                    return false;
                } else if (btn === ORDER.PROVES) {    //打印火化证明单
                    return false;
                }
            }
            if (this.currentRow.REGCURSTATUS != "A" && btn === "附件上传")
                return true;
 
            //宁波调整收费按钮项显隐
            if(btn === '调整收费项'){
                if(this.currentRow.CHDSTATUS === "A"||this.currentRow.CHDSTATUS === "D"){
                    return true;
                }else{
                    return false
                }
            }
             if(btn === '打印冷藏服务单'){
                if(this.currentRow.REGCURSTATUS === "C"){
                    return true;
                }else{
                    return false
                }
            }
            return true;

        },
        //功能操作
        operate(order) {
            this.order = order;
            this.dataRepeat();
            switch (this.order) {
                case PRINT.PRINTSEND: //打印派车单 宁波需求
                    this.$refs.printPdf.open(this.order, this.currentRow.PRPID, null);
                    break;
                case MODIFYCHARGE:         //宁波调整收费项目 
                    this.dataModify();
                    break;
                case '获取联办数据': //获取联办数据
                    this.getLBData()
                    break;
                case ORDER.SELFREGISTER: //自送等级
                case "异地火化": // 上虞
                    this.$refs.simpleReg.open(this.order);
                    break;
                case ORDER.REGISTER://火化登记
                    this.$refs.simpleReg.open(
                        this.order,
                        this.currentRow.REGID,
                        this.currentRow.REGCURSTATUS,
                        this.currentRow
                    );
                    break;
                case '义乌火化登记':
                    this.$refs.simpleReg.open(
                        this.order,
                        this.currentRow.REGID,
                        this.currentRow.REGCURSTATUS,
                        this.currentRow
                    );
                    break;
                case ORDER.MODIFY:
                    this.$refs.simpleReg.open(
                        this.order,
                        this.currentRow.REGID,
                        this.currentRow.REGCURSTATUS,
                        this.currentRow
                    );
                    break;
                case '义乌修改':
                    this.$refs.simpleReg.open(
                        this.order,
                        this.currentRow.REGID,
                        this.currentRow.REGCURSTATUS,
                        this.currentRow
                    );
                    break;
                case ORDER.DELETE:
                    this.confirm(callback => {
                        this.dataDelete();
                    });
                    break;
                case ORDER.INFO:
                    this.$refs.simpleReg.open(
                        this.order,
                        this.currentRow.REGID,
                        this.currentRow.REGCURSTATUS
                    );
                    break;
                case ORDER.GIVEOLDDATAS://老数据推送
                    this.$refs.simpleReg.open(
                        this.order,
                        this.currentRow.REGID
                    ); //老数据推送
                    break;
                case "数据匹配":
                    this.$refs.simpleReg.open("数据匹配"); //数据匹配
                    break;
                case "联办数据匹配":
                    this.$refs.simpleReg.open("联办数据匹配"); //数据匹配
                    break;
                case ORDER.PROVES://打印火化证明单
                    this.$refs.simpleReg.open(
                        this.order,
                        this.currentRow.REGID
                    );
                    break;
              case "打印遗体出冰通知单":  //打印遗体出冰通知单（宁波）
                    this.$refs.simpleReg.open(
                        this.order,
                        this.currentRow.REGID
                    );
                    break;
              case "打印核对单":  //打印核对单（宁波）
                    this.$refs.simpleReg.open(
                        this.order,
                        this.currentRow.REGID
                    );
                    break;
                case ORDER.BUSINESS://打印业务流转单
                    this.$refs.simpleReg.open(
                        this.order,
                        this.currentRow.REGID
                    ); //打印业务流转单
                    break;
                case PRINT.PDFCRENOTIES:
                    this.$refs.printPdf.open(this.order, this.currentRow.REGID);
                    break;
                case PRINT.PDFCRENOTIESSY:
                    this.$refs.printPdf.open(this.order, this.currentRow.REGID);
                    break;
                case PRINT.PDFBONERECEIVE:
                    this.$refs.printPdf.open(this.order, this.currentRow.REGID);
                    break;
                case "打印减免清单"://打印减免清单
                    this.$refs.printPdf.open(this.order, this.currentRow.CHDID);
                    break;
                case ORDER.PTCRFS:
                    this.$refs.simpleReg.open(
                        this.order,
                        this.currentRow.CHDID
                    ); //打印火花登记单
                    break;
                case ORDER.PRINTSL:
                    this.$refs.simpleReg.open(
                        this.order,
                        this.currentRow.CHDID
                    ); //打印火花清单
                    break;
                case ORDER.JOINT:
                    this.$refs.simpleReg.open(
                        this.order,
                        this.currentRow.REGID
                    ); //打印联办单
                    break;
                case "打印冷藏服务单":
                 this.$refs.printPdf.open(this.order, this.currentRow.REGID);
                  //打印冷藏服务单(上虞)
                    break;
                case ORDER.BODYOUTAGE:
                    if (this.currentRow.REGCURSTATUS === "A") {
                        //跳火化登记
                        this.order = ORDER.BODYOUTAGES;
                        this.$refs.simpleReg.open(
                            this.order,
                            this.currentRow.REGID,
                            '',
                            this.currentRow
                        ); //遗体外运1
                    } else {
                        //跳修改
                        this.$refs.simpleReg.open(
                            this.order,
                            this.currentRow.REGID,
                            '',
                            this.currentRow
                        ); //遗体外运
                    }
                    break;
                case ORDER.ESCBODYOUTAGE:
                    this.escbodyoutage();
                    break;
                case "回传附件详情":
                    let infodata = null;
                    if(this.currentRow.REGLBPRPID == ""){
                        infodata = this.currentRow.REGPRPID
                    }else{
                        infodata = this.currentRow.REGLBPRPID;
                    }
                    this.$refs.dialog.operate(
                        "附件上传",
                        infodata
                    ); //附件详情
                    break;
                case "附件上传":
                    this.$refs.dialogs.operate(
                        "附件上传",
                        this.currentRow.REGID,
                        'A'
                    ); //附件详情
                    break;
                case "同意冻结":
                    this.Frozen();
                    break;
                case ORDER.ONEKEYDELETE:
                    this.onekeydelete();
                    break;
                case "操作历史":
                    this.$refs.OperationHistory.open('操作历史',this.currentRow.REGID);
                    break;
                case "派车登记":
                  this.$refs.carSendNewMain.open('义乌派车', this.currentRow.REGBUSNUM);
                  break;
                case "生成联办单":
                  this.$refs.seecSingle.open('生成联办单', this.currentRow.REGID);
                  break;
                case "备注修改":
                  this.modifyRmatk(this.currentRow)
                  break;
                case "到馆扫描":
                  this.pavilionScanning(this.currentRow.REGID)
                  break;
                // case "导出":
                //   this.$refs.printPdf.report(PRINT.PDFDEADFILESEARCH, this.getDataC());
                //   break;
                default:
            }
        },
        // 到馆扫描
        pavilionScanning(id){
            this.$confirm("是否确认到馆扫描?", "提示", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning"
            })
            .then(callback => {
                apiBase.DoService(
                    {
                        REGID:id,
                    },
                    apiBase.getApiAdress().Registration.ScanningToLibrary,
                    res => {
                        this.$message({
                            type: 'success',
                            message: '操作成功'
                        });
                        this.getData() 
                    }
                );
            })
            .catch(() => {
                this.$message({
                    type: "info",
                    message: "已取消"
                });
            });
        },
        // 单独修改备注 义乌
        modifyRmatk(row){
            this.$prompt('备注修改', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                inputValue: row.REGREMARK
            }).then(({value}) => {
                apiBase.DoService(
                    {
                        REGID:row.REGID,
                        REGPRPID:row.REGPRPID,
                        REGREMARK:value,
                    },
                    apiBase.getApiAdress().Registration.UpdateRemark,
                    res => {
                        this.$message({
                            type: 'success',
                            message: '修改成功'
                        });
                        this.getData() 
                    }
                );
            }).catch(() => {
                this.$message({
                    type: 'info',
                    message: '取消修改'
                });       
            });
        },
        //调整收费项目信息
        dataModify() {
        this.$refs.checkoutAdd.open(ORDER.CHEMODIFY, this.currentRow.CHDID);
        },
        // 获取联办数据
        getLBData(){
            // let data = {
            //     REGID: this.currentRow.REGID
            // };
            this.$store.state.isloading = true
            apiBase.DoService(
                {},
                apiBase.getApiAdress().JointRegistration.GetData,
                res => {
                    this.$message({
                        message: res.data.content,
                        type: "info"
                    });
                    this.getData() 
                },
                res => {
                },
                // 'GET'
            );
        },
        //登记删除
        dataDelete() {
            let data = {
                REGID: this.currentRow.REGID
            };
            apiBase.DoService(
                data,
                apiBase.getApiAdress().Registration.Delete,
                res => {
                    this.getData();
                    this.getAllData();
                    this.$message({
                        message: this.order + res.data.msg,
                        type: "success"
                    });
                },
                res => {
                    this.$message.error(res.data.msg);
                }
            );
        },
        //一键删除
        onekeydelete() {
            this.$confirm("确认是否删除该人员的所有数据?", "提示", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning"
            })
                .then(callback => {c
                    let data = {
                        REGID: this.currentRow.REGID
                    };
                    apiBase.DoService(
                        data,
                        apiBase.getApiAdress().Registration.AllDelete,
                        res => {
                            this.getData();
                            this.getAllData();
                        }
                    );
                    // let data = {
                    //   REGID: this.currentRow.REGID
                    // };
                    // apiBase.DoService(
                    //   data,
                    //   apiBase.getApiAdress().Registration.CancelBodyoutageRegistration,
                    //   res => {
                    //     this.getData();
                    //     this.$message.success("取消成功");
                    //   });
                })
                .catch(() => {
                    this.$message({
                        type: "info",
                        message: "已取消"
                    });
                });
        },
        //取消遗体外运
        escbodyoutage() {
            this.$confirm("确认是否取消遗体外运?", "提示", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning"
            })
                .then(callback => {
                    let data = {
                        REGID: this.currentRow.REGID
                    };
                    apiBase.DoService(
                        data,
                        apiBase.getApiAdress().Registration
                            .CancelBodyoutageRegistration,
                        res => {
                            this.getData();
                            this.getAllData();
                            this.$message.success("取消成功");
                        }
                    );
                })
                .catch(() => {
                    this.$message({
                        type: "info",
                        message: "已取消"
                    });
                });
        },

        Frozen() {
            this.$confirm("确认是否冻结该数据?", "提示", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning"
            })
                .then(callback => {
                    let data = {
                        REGID: this.currentRow.REGID
                    };
                    apiBase.DoService(
                        data,
                        apiBase.getApiAdress().Registration.AllowFreeze,
                        res => {
                            this.getData();
                            this.getAllData();
                            this.$message.success("冻结成功");
                        }
                    );
                })
                .catch(() => {
                    this.$message({
                        type: "info",
                        message: "已取消"
                    });
                });
        },
        //查询条件重置
        btnRepeat() {
            this.selectData.CdhactualdateGreaterAndEquals = null;
            this.selectData.CdhactualdateLessAndEquals = null;
            this.selectData.RegAppointDateGreaterAndEquals = null;
            this.selectData.RegAppointDateLessAndEquals =null;
            Object.assign(
                this.$data.selectData,
                this.$options.data().selectData
            );
            if (this.isall === false) {
                this.selectDataEixend.regDateValue = DATESELECTMODE.now;
                this.selectData.RegdateOrRegCremationdate = formatDate(
                    new Date(),
                    "yyyyMMdd"
                );
            } else {
                this.selectDataEixend.regDateValue = DATESELECTMODE.all;
            }
            setTimeout(() => {
                // this.initSeachdata();
                this.getData();
                this.getAllData();
            }, 100);
        },
        //数据重置
        dataRepeat() {
            Object.assign(this.$data.regData, this.$options.data().regData);
            this.causList = [];
            this.ctyLists = [];
            this.regDataTime = null;
            this.cauinfo = [];
        },
        //死亡原因
        caeChange(val) {
            for (var i in this.cause) {
                if (this.cause[i].CAEID === val) {
                    this.causList = this.cause[i].Caus;
                }
            }
        },
        initSeachdata() {
        },

        // 是否显示冻结状态
        pushhfmode() {
            let data = {};
            apiBase.DoService(
                data,
                apiBase.getApiAdress().Param.GetPushHFMode,
                res => {
                    this.pushhfmode = res.data.content;
                }
            );
        },
        isshowDjzt() {
            let data = {};
            apiBase.DoService(
                data,
                apiBase.getApiAdress().Param.GetIsShowImageByList,
                res => {
                    this.hiddenWarn = res.data.content;
                }
            );
        },
        //火化登记老数据标识查询条件是否显示
        getIsShowOldDate() {
            let data = {};
            apiBase.DoService(
                data,
                apiBase.getApiAdress().Param.GetIsShowOldDate,
                res => {
                    this.isShowOldDate = res.data.content;
                }
            );
        },
        //火化登记业务编号查询条件是否显示 isShowBuessnum isShowOldDate
        getIsShowBuessnum() {
            let data = {};
            apiBase.DoService(
                data,
                apiBase.getApiAdress().Param.GetIsShowBuessnum,
                res => {
                    this.isShowBuessnum = res.data.content;
                }
            );
        },
        searchMatchData(value){
          this.selectData.RegbussnumLike = value
          this.getData()
        },
    },
    mounted() {
        this.initSeachdata();
    },
    components: {
        dataTable,
        cresimplereg,
        printmodal,
        Appendixlists,
        Appendixlisttwo,
        OperationHistory,
        carSendNewMain,
        seecSingle,
        checkoutAdd
    },
    activated() {
        if(this.isFirst){
            apiBase.DoService(
                {},
                apiBase.getApiAdress().Param.GetIsRegShowAll,
                res => {
                    this.isall = res.data.content;
                    if (res.data.content === true) {
                        this.selectDataEixend.regDateValue = DATESELECTMODE.all;
                        this.selectData.RegdateOrRegCremationdate = null;
                    } else {
                        this.selectDataEixend.regDateValue = DATESELECTMODE.now;
                        this.selectData.RegdateOrRegCremationdate = formatDate(
                            new Date(),
                            "yyyyMMdd"
                        );
                    }
                    this.getData();
                    this.getAllData();
                    this.isFirst = false
                }
            );
        }else{
            this.getData();
            this.getAllData();
        }
        for (let btn of this.$store.state.btnListCommon) {
            if (btn.BTNVALUE === ORDER.REGISTER) {
                btn.BTNSHOWNAME = "修改";
                break;
            }
        }
    },
    created() {
        apiBase.DoService({},apiBase.getApiAdress().Param.GetIsRegStatusFontColor,res => {
            this.isFontColor = res.data.content; 
        });
        apiBase.DoService({},apiBase.getApiAdress().Param.GetIsDataTableReddening,res => {
            this.ischangered = res.data.content; 
        });
        apiBase.DoService({},apiBase.getApiAdress().Param.GetIsCreChangeRed,res => {
            this.ischangnb = res.data.content; 
        });
        this.getColumns();
        this.getCode();
        this.getCausa();
        this.getBussType();
        this.getHousehold();
        this.IsSendJointByFinal();
        this.isshowDjzt();
        this.pushhfmode();
        this.getIsShowBuessnum();
        this.getIsShowOldDate();
        this.getnoIce(); //获取未使用冰柜信息
    },
    watch: {
        "selectDataEixend.regDateValue": function(val) {
            this.selectData.RegdateGreater = null;
            this.selectData.RegdateOrRegCremationdate = null;
            switch (val) {
                case DATESELECTMODE.now:
                    this.selectData.RegdateOrRegCremationdate = formatDate(
                        new Date(),
                        "yyyyMMdd"
                    );
                    break;
                case DATESELECTMODE.future:
                    this.selectData.RegdateGreater = formatDate(
                        new Date(),
                        "yyyyMMdd"
                    );
                    break;
                default:
                    break;
            }
        },
        "$store.state.btnListCommon": function(val) {
            for (let btn of this.$store.state.btnListCommon) {
                if (btn.BTNVALUE === ORDER.REGISTER) {
                    btn.BTNSHOWNAME = "修改";
                    break;
                }
            }
        }
    }
};
</script>
